package com.example.user.myhjjf_app.presenter;

import android.graphics.Color;
import android.util.Log;

import com.example.user.myhjjf_app.R;
import com.example.user.myhjjf_app.model.Model_Oc;
import com.example.user.myhjjf_app.model.Model_zhcsg;
import com.zhy.adapter.abslistview.ViewHolder;
import com.zhy.adapter.abslistview.base.ItemViewDelegate;

import java.util.Map;

/**
 * Created by User on 2017/9/5.
 */

public class Presenter_Csg_adaoter implements ItemViewDelegate {
    private int type;
    private Map<String,Model_zhcsg.ValueBean> nums;
    public Presenter_Csg_adaoter(int type,Map<String,Model_zhcsg.ValueBean> nums){
        this.type = type;
        this.nums = nums;
    }
    @Override
    public int getItemViewLayoutId() {
        return type==1? R.layout.activity_listitem_zhcsg_odp:R.layout.activity_listitem_zhcsg_ddf;
    }

    @Override
    public boolean isForViewType(Object item, int position) {
        return true;
    }

    @Override
    public void convert(ViewHolder holder, Object o, int position) {

        if (nums.containsKey(String.valueOf(position))){
            if (type==1){
                holder.setBackgroundColor(R.id.im_item2, Color.parseColor("#009900"));
            }
                holder.setBackgroundColor(R.id.im_item1, Color.parseColor("#009900"));
        }else {
            if (type==1){
                holder.setBackgroundColor(R.id.im_item2,Color.parseColor("#888888") );
            }
            holder.setBackgroundColor(R.id.im_item1,Color.parseColor("#888888"));
        }

    }

}
